package com.sp.system.user.core.customer.impl;

import com.sp.system.user.core.customer.IQueueCustomer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class QueueCustomerImpl implements IQueueCustomer {


    @Override
    @SendTo("SP-CORE-QUEUE")
    @JmsListener(destination= "sp_queue", containerFactory = "jmsListenerContainerQueue")
    public String receiverStringQueue(String name) {
        System.out.println("消费者成功获取到生产者的消息，name="+name);
        return "消费者成功获取到生产者的消息，name=" + name;
    }

    @Override
    @JmsListener(destination = "sp_queue", containerFactory = "jmsListenerContainerQueue")
    public void receiverQueue(String msg) {
        System.out.println("接收到消息A...." + msg);
    }
}
